<template>
	<view style="height: 100%;display: flex;flex-direction: column;">
		<view class="" style="overflow-y: scroll;padding-bottom: 50rpx;flex: 1;">
			<view class="" style="background-color: #FFFFFF; border-top: 2rpx solid rgba(235,235,235,0.5);">
				<view class="oneTui uni-flex" >
					<view class="" style="position: relative;margin-right: 16rpx;">
						<view class="touxiang">
							<image :src="$jiekou.uploadBaseUrl+info.head" mode="" class=""></image>
						</view>
						<!-- <view class="zaixian yuandian "></view> -->
					</view>
					
					<view class="neirong" style="">
						<view class="uni-flex">
							<view class="" style="flex: 1;">
								<text class="user-name">{{info.username}}</text>
								<image v-if="info.attestation==2" src="../../static/image/yirenzheng.png" mode="" class="renzhengtu"></image>
							</view>
							<view v-if="info.pingfenStr!='' && info.pingfenStr!=undefined " class="pingding">综合评定:{{info.pingfenStr}}</view>
							<view v-else class="pingding">综合评定:未评分</view>
						</view>
						<view class="biaoqians uni-flex">
							<view class="biaoqian">商家ID：{{info.uid}}</view>
							<view class="biaoqian" v-if="info.tuanduiid != undefined && info.tuanduiid != ''">团队ID：{{info.tuanduiid}}</view>
						</view>
					</view>
				</view>
			</view>
			
			<view class="content">
				<view class="title-text">任务信息</view>
				<view class="">
					<!-- <view class="uni-flex one-label" >
						<view class="title-text labelcolor">任务ID</view>
						<view class="label-data">{{info.id}}</view>
					</view> -->
					<view class="uni-flex one-label" >
						<view class="title-text labelcolor">任务标题</view>
						<view class="label-data">{{info.title}}</view>
					</view>
					<view class="uni-flex one-label" >
						<view class="title-text labelcolor">购物平台</view>
						<view class="label-data">{{info.pingtaiStr}}</view>
					</view>
					<view class="uni-flex one-label" >
						<view class="title-text labelcolor">店铺ID</view>
						<view class="label-data">{{info.shopid}}</view>
					</view>
					<view class="uni-flex one-label" >
						<view class="title-text labelcolor">截止日期</view>
						<view class="label-data">{{info.jiezhi_time | dateFormat('YYYY年mm月dd日')}}</view>
					</view>
					<view class="uni-flex one-label" >
						<view class="title-text labelcolor">所需单数</view>
						<view class="label-data">{{info.danshu}}单</view>
					</view>
				</view>
			</view>
			
			<view class="content">
				<view class="">
					<view class="uni-flex one-label" >
						<view class="title-text labelcolor">商品价格</view>
						<view class="label-data">¥{{info.pirce}}</view>
					</view>
					<view class="uni-flex one-label" >
						<view class="title-text labelcolor">任务佣金</view>
						<view class="label-data">¥{{info.danwei_yongjin}}</view>
					</view>
					<view class="uni-flex one-label" >
						<view class="title-text labelcolor" style="width: auto;">是否有礼品</view>
						<view class="label-data" v-if="info.lipin==1">是</view>
						<view class="label-data"v-else>否</view>
					</view>
				</view>
			</view>
			
			<view class="content">
				<view class="title-text">备注：</view>
				<text class="beizhu">
					{{info.beizhu}}
				</text>
			</view>
		</view>
		<view class="jieshou">
			<view class="renwu" @tap="show=true">
				<view class="">请求接单</view>
			</view>
		</view>
		<u-toast ref="uToast"></u-toast>
		<!-- <u-modal :content="content"></u-modal>
		<u-picker v-model="time_show" mode="time"></u-picker> -->
		<u-modal v-model="show" content="请确认是申请接受该任务" @confirm="jieshouRenwu()" :show-cancel-button="true"></u-modal>
		
	</view>
</template>

<script>
	import util from '@/common/util.js';
	export default {
		data() {
			return {
				info:{},
				userId:uni.getStorageSync("token"),
				toastType:"default",
				time_show:false,
				content:"",
				isTijiao:true,
				show:false
			}
		},
		onLoad:function(parans){
			var that = this;
			console.log(parans.id);
			that.$util.nuiAjax(that.$jiekou.selectTaskInfo,{taskId:parans.id},function(res){
				console.log(JSON.stringify(res));
				that.info = res;
			});
		},
		methods: {
			zaixian:function(id){
				this.$store.commit('createConversationActive', id)
				uni.navigateTo({
					url: '../chat/chat'
				})
			},
			jieshouRenwu:function(){
				
				var that = this;
				that.isTijiao = false;
				that.$util.nuiAjax(that.$jiekou.shenqingJiedan,{taskId:this.info.id,uid:that.userId},function(res){
					console.log(JSON.stringify(res));
					if(res.result=="true"){
						that.$refs.uToast.show({
							title: "申请成功",
							back:true
						});
						// uni.navigateBack();
					}else{
						that.isTijiao = true;
						that.$refs.uToast.show({
							title: res.message
						});
					}
				});
				
			}
		},
		filters:{
			dateFormat:(date,str)=>{
				if(date!=undefined){
					return util.dateUtils.dateFormat('YYYY年mm月dd日',new Date(date));
				}else{
					return "";
				}
			}
		}
	}
</script>

<style lang="scss">
	.renwu{
		flex:1;
		padding: 16rpx 0;
	}
	.lianxi image{
		width: 40rpx;
		height: 40rpx;
		margin-top: 42rpx;
		margin-left: 60rpx;
		
	}
	.lianxi view{
		height:40rpx;
		font-size:28rpx;
		font-weight:400;
		color:$uni-color-primary;
		line-height:40rpx;
		padding-top: 42rpx;
		padding-left: 20rpx;
	}
	.lianxi{
		flex:1;
	}
	.renwu view{
		// height:40rpx;
		font-size:35rpx;
		font-weight:500;
		color:#FFFFFF;
		line-height:40rpx;
		padding:20rpx 0 20rpx;
		// background-color: $uni-color-primary;
		text-align: center;
		// margin-right: 30rpx;
		// border-radius:4rpx;
	}
	.jieshou{
		background-color: $uni-color-primary;
		height: 112rpx;
		display: flex;
		flex-direction: row;
		
	}
	.beizhu{
		height:40rpx;
		font-size:28rpx;
		font-weight:400;
		color:#999999;
		line-height:40rpx;
		padding-top: 10rpx;
	}
	.label-data{
		height:40rpx;
		font-size:28rpx;
		font-weight:400;
		color:rgba(51,51,51,1);
		line-height:40rpx;
	}
	.one-label{
		padding-top: 30rpx;
		justify-content: space-between;
	}
	.labelcolor{
		color: #999999;
		text-align: right;
	}
	.title-text{
		width:112rpx;
		height:40rpx;
		font-size:28rpx;
		font-weight:400;
		line-height:40rpx;
	}
	.content{
		padding: 30rpx;
		margin-top: 20rpx;
		background-color: #FFFFFF;
	}
	
	page{
		background-color: $page-bg-color;
		height: 100%;
	}
	.oneTui .zaixian{
		background-color: #10C82E;
	}
	.yuandian{
		position: absolute;
		width: 24rpx;
		height: 24rpx;
		border-radius:24rpx;
		background-color: #818181;
		right: 0;
		bottom: 4rpx;
		
	}
	.pingding{
		height:40rpx;
		font-size:28rpx;
		font-weight:400;
		color:rgba(51,51,51,1);
		line-height:40rpx;
		padding-right: 30rpx;
	}
	.touxiang{
		width: 92rpx;
		height: 92rpx;
		border-radius:50rpx;overflow: hidden;
		
	}
	.touxiang image{
		width: 100%;
		height: 100%;
	}
	.user-name{
		height:44rpx;
		font-size:32rpx;
		font-weight:500;
		color:rgba(25,25,25,1);
		line-height:44rpx;
		padding-right: 8rpx;
	}
	.renzhengtu{
		width: 26rpx;
		height: 32rpx;
		margin-top: 6rpx;
	}
	.biaoqian{
		height:34rpx;
		font-size:24rpx;
		font-weight:400;
		color:$uni-color-primary;
		line-height:34rpx;
		border: 1rpx solid $uni-color-primary;
		border-radius: 4rpx;
		padding: 2rpx 8rpx 0 8rpx;
		margin-right: 8rpx;
	}
	.neirong{
		flex: 1;
	}
	.oneTui{
		background-color: #FFFFFF;
		padding: 30rpx 0 32rpx 30rpx;
		border-bottom: 1rpx solid #EEEEEE;
	}
</style>
